package com.moli.iov.down.command.design.factory;

import com.moli.iov.down.command.design.decorator.AbstractSendCommand;
import com.moli.iov.down.command.design.decorator.KafkaSendCommand;
import com.moli.iov.down.command.design.decorator.dectrators.ActiveMqDecorator;
import com.moli.iov.down.command.design.decorator.dectrators.CacheDecorator;
import com.moli.iov.down.enums.SendFactoryEnum;

/**
 * <p>
 *  发送命令对象 工厂
 * </p>
 *
 * @author: zql
 * @Date: 2019/1/16 11:39
 */
public class SendFactory {

    private SendFactory(){}

    public static AbstractSendCommand get(String decoratorName, AbstractSendCommand aSendCommand){
        if(SendFactoryEnum.KAFKA.getFlag().equals(decoratorName)){

            return new KafkaSendCommand();
        }else if(SendFactoryEnum.ACTIVEMQ.getFlag().equals(decoratorName)){

            return new ActiveMqDecorator(aSendCommand);
        }else if(SendFactoryEnum.CACHE.getFlag().equals(decoratorName)){

            return new CacheDecorator(aSendCommand);
        }
        return null;
    }
}
